﻿using System;

namespace E4RPTools
{
    public class Result
    {
        #region Members

        private bool _failed;
        private readonly ErrorList _errors = new ErrorList();

        #endregion

        #region Properties

        public bool Failed { get { return _failed; } set { _failed = value; } }

        public ErrorList Errors { get { return _errors; } }

        #endregion

        #region Public Methods

        public Result()
        {
        }

        public Result(String reference, String message)
        {
            Add(reference, message);
        }

        public void Add(String reference, String message)
        {
            _errors.Add(new Error(reference, message));
            _failed = true;
        }

        public void Reset()
        {
            _failed = false;
            _errors.Clear();
        }

        #endregion
    }
}
